package com.sc.smartcommunity.controller;

import com.sc.smartcommunity.domain.Repair;
import com.sc.smartcommunity.service.RepairService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/repair")
public class RepairController {

    @Autowired
    private RepairService repairService;

    /**
     * 添加报修信息
     */
    @PostMapping("/add")
    public String addRepair(@RequestBody Repair repair) {
        boolean result = repairService.addRepair(repair);
        return result ? "添加成功" : "添加失败";
    }

    /**
     * 查询所有报修信息
     */
    @GetMapping("/findAll")
    public List<Repair> findAllRepairs() {
        return repairService.findAllRepairs();
    }
    
}